<template>
<div class="page has-navbar has-tabbar" >
   	<von-header theme="assertive">
        <button class="button button-icon ion-ios-arrow-back" type="button" slot="left" @click="$router.go(-1)"></button>
        <span slot="title">启辕合作</span>
	</von-header>
    <div class="page-content padding-top">
        <p class="cooperation">如果您不是启辕的合作商户，请填写合作信息，留下您的联系方式，我们会尽快与您联系，或者拨打客服电话400-150-1999</p>
        <item class="y-item"  style="margin-bottom: 100px;">
            <span class="item-title">联系方式</span>
            <input type="tel" class="y-item-input" name="carTitle" required onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" autocomplete="off" maxlength=11 v-model="tel" placeholder="请输入您的手机号" required>
        </item>
        <div class="outbtn" ><md-button class="button button-assertive button-block" @click.native="Successubmit">提交</md-button></div>
        <div v-if="isShow" class="diolog"><img src="static/images/success.png" alt=""></div>
    </div>
    
</div>
</template>
<script>
    export default {
        data () {
            return {
                tel: '',
                isShow: false
            }
        },
        methods: {
            Successubmit () {
                var myreg=/^\d{11}/; 
                if (this.tel == '' || !myreg.test(this.tel)) {
                     $toast.show('请输入正确的手机号');
                     return false;
                } else {
                    var _that = this;
                    let formData = new FormData()
                        formData.append('cooperationMobile',this.tel)
                        window.axios.post(baseUrl+'/controller/cooperation/insertCooperation',formData).then(res=>{
                            if(res.data.code ==1){
                                this.isShow = true;
                                setTimeout(function () {
                                    _that.isShow = false;
                                }, 1000);
                            }
                        })
			        }
            }
        }
    }
    
</script>
<style scoped>
.page{}
.diolog{width: 160pt; height: 113pt; background-color: #000; opacity: .7; position: absolute; top: 50%; left: 50%; margin-left: -80pt; margin-top: -60pt; border-radius: 5pt;}
.diolog>img{width: 42pt; height: 42pt; position: absolute; left: 50%; margin-left: -20pt; bottom: 50%; margin-bottom: -20pt; z-index: 999;} 
</style>
 